package com.example.mybatis_demo.controller;

import com.example.mybatis_demo.mapper.dbtest.AccountMapper;
import com.example.mybatis_demo.mapper.dbtest2.MusicMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
public class TestController {
    @Autowired
    AccountMapper accountMapper;
    @Autowired
    MusicMapper mmusicMapper;

    @RequestMapping("/accounts")
    @ResponseBody
    public String getAccounts(){
        System.out.println("getAccounts");
        List<String> accounts = accountMapper.findAccounts();
        System.out.println(accounts.toString());
        return accounts.toString();
    }

    @RequestMapping("/music")
    @ResponseBody
    public String getMusicNames(){
        System.out.println("getMusicNames");
        List<String> names = mmusicMapper.findMuiscNames();
        System.out.println(names.toString());
        return names.toString();
    }
}
